import React from 'react'
import store from '../../store'
//引入movieActions
import { getmovieAction } from '../../store/actions/movieActions'
export default function Movie() {
  //通过 store.getState()的方法获取到store中的值并解构出来
  const { count } = store.getState().count
  //拿到store中的电影列表
  const { movielist } = store.getState().movie
  console.log(movielist, 'movielist');
  //通过redux实现共享

  //获取电影列表事件
  const requestMovie = () => {
    store.dispatch(getmovieAction())
  }
  return (
    <div>
      <h1>Movie</h1>
      
      <button onClick={requestMovie}>获取电影列表</button>

      {
        movielist.map(item => {
          return <li key={item.albumId}>{item.name}</li>
        })
      }
    </div>
  )
}
